/*!
   \file

   \brief
      Platform provides an interface abstraction for specific platforms, such as Windows, Mac OS,
      and Linux. The parts of the abstraction that don't need specific platform knowledge are in
      Platform.cpp, the rest are in platform-specific libraries such as AvionWin (Windows) or
      AvionNix (Linux).

   © 2011 Mark W. Gabby II

   This file is part of the Avion engine.

   The Avion engine is free software: you can redistribute it and/or modify it under the terms of
   the GNU General Public License as published by the Free Software Foundation, either version 3 of
   the License, or (at your option) any later version.

   The Avion engine is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
   without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
   the GNU General Public License for more details.

   You should have received a copy of the GNU General Public License along with the Avion Engine.
   If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once
#include <list>

#include "Systems/Constants/PlatformTypes.hpp"
#include "Systems/Constants/InputTypes.hpp"


namespace pf
{
void SetInputMessageCallback( tSendInputMessage Callback );
void SetInputControllerCapturedCallback( tControllerCaptured Callback );
void SetInputControllerReleasedCallback( tControllerReleased Callback );
void SetInputModifierStateCallback( tSetModifierState Callback );

void SetAddGraphicsViewportCallback( tAddGraphicsViewport Callback );

/*!
   \brief
      Sets up the platform. Call this before using any of the functions.
*/
bool Initialize();

/*!
   \brief
      Sets the resolution and color depth of a monitor.
   \return
      True if setting successful, false otherwise.
*/
bool SetScreenMode( tScreenModeIndex ScreenModeIndex, tMonitorIndex MonitorIndex );

// Rendering Functions //
/*!
   \brief
      Sets a window to have the active context.
*/
void SetActiveContext( const tWindowID WindowID );
/*!
   \brief
      Performs buffer swap that allows rendering to show up.
*/
void SwapBuffers( const tWindowID WindowID );

// Miscellaneous Functions //
/*!
   \brief
      Creates a popup dialog box.

   \param Title
      The title of the box.
   \param Message
      The message shown in the box.
   \param Type
      Type of message - see eMessageTypes.
   \param Options
      What options the messagebox gives the user to respond with.
   \param WindowID
      ID of the window to show the message in.

   \return
      The result - which button the user pressed.
*/
eMessageResults CreateOSDialog( const char * const Title, const char * const Message,
                                const eMessageTypes Type, const eMessageOptions Options,
                                const tWindowID WindowID );

/*!
   \brief
      Returns the directory in which fonts are stored on this platform.
*/
std::string GetFontDirectory();

/*!
   \brief
      Returns a list of paths to files in the passed-in directory.

   \param Directory
      Directory to search.
   \param ExclusiveExtension
      Pass in an extension to exclusively get files with said extension. Pass in NULL to get all
      files.
*/
std::list<std::string> GetDirectoryFilePaths( const char * const Directory, const char * const ExclusiveExtension = NULL );

/*!
   \brief
      Returns true if the keyboard key is down, false otherwise.
*/
bool IsKeyboardKeyDown( const eKeyboardKey Which );

// Misc display functions
float GetDesktopGamma();

void WriteMonitors( std::ofstream & Out );
void WriteDisplayFormats( std::ofstream & Out );
void WritePixelFormats( std::ofstream & Out );
}
